<template>
   <div>
     <div id="slider" class="mui-slider">
				<div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
					<div class="mui-scroll">
						<a :class="['mui-control-item',item.id==0?'mui-active':'']" v-for="item in cate" :key="item.id" @click="getphotolist(item.id)">
							{{item.title}}
						</a>
					</div>
				</div>
			</div>
		<ul class="lz-ld">
             <router-link :to='"/home/photoinfo/"+item.id' v-for="item in list" :key="item.id" tag="li">
               <img v-lazy="item.img_url">
			   <div class="list-info">
			          <h3 class="list-title">
						  {{item.title}}
					  </h3>
			          <div class="list-content">
						  {{item.zhaiyao}}
					  </div>
		</div>
             </router-link>
        </ul>
		
   </div>
</template>
<script>
import mui from "../../lib/mui/js/mui.min.js";

export default {
	data(){
		return{
	 cate:[],
	 list:[]
		}
	},
	created(){
	 this.getCatery(),
	 this.getphotolist(0)
	},
  mounted(){
      mui('.mui-scroll-wrapper').scroll({
	deceleration: 0.0005
});
	},
	methods:{
		getCatery(){
			this.$http.get("api/getimgcategory").then(result=>{
						result.body.message.unshift({title:"全部",id:0})
						this.cate=result.body.message
						
			})
		},
		getphotolist(id){
			this.$http.get("api/getimages/"+id).then(result=>{
				if(result.body.status===0){
					this.list=result.body.message;				
				}
			})
		}
	}
}
</script>
<style>
*{
    touch-action: none;
}
.lz-ld li{
	position: relative;
	background-color: #ccc;
	text-align: center;
	margin-bottom: 10px;
	box-shadow: 0 0 10px #ccc;
}
.lz-ld li img{
	width: 100%;
	display: block;
}
.lz-ld{
	padding: 0;
	margin: 10px 10px;
	list-style: none;
}
.lz-ld li img[lazy=loading] {
  width: 40px;
  height: 300px;
  margin: auto;
}
.lz-ld li .list-info{
	position: absolute;
	max-height: 84px;
	bottom: 0;
	text-align: left;
	background-color: rgba(0,0,0,0.5);
	color: white;
}
.lz-ld li .list-info .list-title{
	font-size: 14px;
}
.lz-ld li .list-info .list-content{
	font-size: 13px;
}
</style>

